package cn.cosmosx.base.constant;

/**
 * 全局参数配置类
 */
public interface GlobalConstant {
    /**
     * 浏览器请求头认证Token Key
     */
    String TOKEN = "Authorization";

    /**
     * 浏览器请求头加密Token Key
     */
    String ENCRYPT_TOKEN = "EncryptToken";

    /**
     * access-token 的有效时长 (秒)
     */
    long LIFE_TIME = 60 * 30;

    /**
     * 角色权限信息
     */
    String PERMISSIONS = "permissions";

    String AccessKey = "access";

    /**
     * Redis缓存Session Key
     */
    static String getAccessKey(Long userId, String token) {
        return AccessKey + "::" + userId + "::" + token;
    }

    /**
     * Redis缓存Session Key前缀
     *
     * @param userId - 用户id
     * @return
     */
    static String getAccessKeyPre(Long userId) {
        return AccessKey + "::" + userId + "::";
    }
}
